package com.landscope.issue.controller.wx;

import com.landscope.issue.controller.base.ResponseResult;
import com.landscope.issue.controller.wx.dto.AppletMainMessageDto;
import com.landscope.issue.controller.wx.dto.AppletMonitorDataDto;
import com.landscope.issue.controller.wx.dto.AppletMonitorViewDto;
import com.landscope.issue.controller.wx.param.AppletMainGetNoticeParam;
import com.landscope.issue.controller.wx.param.AppletMonitorAddTopParam;
import com.landscope.issue.controller.wx.param.AppletMonitorDeleteTopParam;
import com.landscope.issue.controller.wx.param.AppletMonitorViewParam;
import com.landscope.issue.service.applet.ApiAppletMonitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RequestMapping("api/applet/monitor")
@RestController
@Api(tags = "6.小程序-监测数据")
@CrossOrigin
public class ApiAppletMonitorController {
    @Resource
    private ApiAppletMonitorService apiAppletMonitorService;

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "6.1 获取监测数据",notes = "获取监测数据")
    @PostMapping("/data")
    public ResponseResult<AppletMonitorDataDto> data(@RequestBody AppletMainGetNoticeParam param){
        return apiAppletMonitorService.data(param);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "6.2 添加置顶参数",notes = "添加置顶参数")
    @PostMapping("/add")
    public ResponseResult add(@RequestBody AppletMonitorAddTopParam param){
        return apiAppletMonitorService.addTopParam(param);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "6.3 删除置顶参数",notes = "删除置顶参数")
    @PostMapping("/del")
    public ResponseResult del(@RequestBody AppletMonitorDeleteTopParam param){
        return apiAppletMonitorService.delTopParam(param);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", name = "token", value = "token", dataType = "String")
    })
    @ApiOperation(value = "6.4 监测数据详情",notes = "监测数据详情")
    @PostMapping("/view")
    public ResponseResult<AppletMonitorViewDto> view(@RequestBody AppletMonitorViewParam param){
        return apiAppletMonitorService.view(param);
    }
}
